import request from '@/request'

// 通过用户 ID 查询用户的订单服务
export const getCarByUserId = () => {
    return request({
        url: '/car_web/by_user_id',
        method: 'GET'
    })
}

// 添加一个订单
export const addOrderService = (params: Record<string, any>) => {
    return request({
        url: '/order_web/add_order',
        method: 'POST',
        params
    })
}

// 搜索服务
export const searchService = (params: Record<string, any>) => {
    return request({
        url: '/service_web',
        method: 'GET',
        params
    })
}

// 购物车物品购买
export const purchase = (params: Record<string, any>) => {
    return request({
        url: '/cart_web/cart_order',
        method: 'POST',
        params
    })
}

// 完成订单
export const finished = (params: Record<string, any>) => {
    return request({
        url: '/order_web/finish_order',
        method: 'POST',
        params
    })
}

// 删除订单
export const deleteOrder = (id: number) => {
    return request({
        url: `/order_web/del_order/${id}`,
        method: 'POST'
    })
}

// 获取商铺列表
export const getShopList = () => {
    return request({
        url: '/user_web/shop_list',
        method: 'GET'
    })
}

// 获取当前商户发布过的服务
export const getShopService = (params: Record<string, any>) => {
    return request({
        url: '/user_web/service_publish',
        method: 'GET',
        params
    })
}

// 发布添加一个服务
export const addService = (params: Record<string, any>) => {
    return request({
        url: '/service_web/add_service',
        method: 'POST',
        params
    })
}
